package com.zprmb.udzt;

import java.text.DecimalFormat;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.zprmb.udzt.ll.BaseHelper;
/**
 * 充值成功
 * @author shenshao
 *
 */
public class Addmoney extends BaseActivity implements OnClickListener{
	private Button btn_confirm;
	private TextView tv_addmonry,my_zhanghu;
	DecimalFormat df = new DecimalFormat("###0.00");
	private ImageView img_back;
	private RelativeLayout rl_back;
	private TextView tv_customer;
	@Override
	protected void onDestroy() {
		// TODO Auto-generated method stub
		super.onDestroy();
		BbtApplication.getInstance().removeActvity(this);
	}
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.add_success);
		 BbtApplication.getInstance().addActvity(this);
		 
	        my_zhanghu=(TextView)findViewById(R.id.my_zhanghu);
			my_zhanghu.setOnClickListener(this);
			tv_customer=(TextView)findViewById(R.id.enterprise_tel);
			tv_customer.setOnClickListener(this);
		tv_addmonry=(TextView)findViewById(R.id.add_money);
		img_back=(ImageView)findViewById(R.id.img_back);
		tv_addmonry.setText("恭喜您! 成功充值    "+df.format(Double.parseDouble(getIntent().getStringExtra("money")))+"元");
		btn_confirm=(Button)findViewById(R.id.btn_confirm);
		rl_back=(RelativeLayout)findViewById(R.id.rl_back);
		rl_back.setOnClickListener(this);
		img_back.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
			  finish();	
			}
		});
		btn_confirm.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intent = new Intent(Addmoney.this,MainActivity.class);
				intent.putExtra("tab", 1);
				startActivity(intent);
			}
		});
	}
	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch(v.getId()){
		case R.id.rl_back:
			finish();
			break;
		case R.id.my_zhanghu:
			  Intent mIntent = new Intent();
              mIntent.setAction("exit1");
              sendBroadcast(mIntent);
              finish();
			break;
		case R.id.enterprise_tel:
			BaseHelper.showDialog2(this, "拨号", "400-0101-016", 1);
			break;
		}
	}

}
